import java.util.LinkedList;
import java.util.Random;
/**
 * Process Manager
 * 
 * @author (?) 
 * @version (10/10/09)
 */
public class ProcessManager // implements Runnable 
{
    // TODO:
    // 1. create Device class that can represent a CPU & IO device & execute commands
    // 2. create the Queue. should be able to hand multiple types of scheduling algorithms
    // 3. create the Process Control (PCB) object. This'll be our representation of processes.
    
    // private Device CPU, IO;
    private LinkedList<Process> wait_queue, ready_queue, io_queue;
    private Computer computer;
    
    public ProcessManager(Computer c) {
        computer = c;
		
		wait_queue = new LinkedList<Process>();
		ready_queue = new LinkedList<Process>();
		io_queue = new LinkedList<Process>();
		
		Random rng = new Random();
		
		for(int i = 0; i < rng.nextInt(10) + 1; i ++)
			wait_queue.offer(Process.random());
    }

	public String toString() {
		return "Wait Queue: " + wait_queue.toString() + "\nReady Queue: " + ready_queue.toString() + "\nIO Queue: " + io_queue.toString();
	}

	public void handle_wait() {
		// look at wait_queue...
		// need to make sure we try and spread out CPU & IO queues
	}
	
	public void handle_cpu() {
		// let the ready queue run once through round robin style!
	}
	
	public void handle_io() {
		// let the IO queue run first job to completion?
	}
}
